//函数定义
function sum(a:number,b:number):number{
    return a+b;
}
console.log('sum: '+sum(1,1));

var strSum=function(a:string,b:string):number{
    return parseInt(a+b);
}

console.log('strSum: '+strSum('1','1'));

//重载的概念
function plus(a:number,b:number):number;

function plus(a:string,b:string):number;

function plus(a:any,b:any):any{
    if(typeof a=='string'){
        return parseInt(a)+parseInt(b);
    }else{
        return a+b;
    }
}
console.log('plus:'+plus(1,1));
console.log('plus:'+plus('1','1'));